﻿@model ChangePasswordModel
@using Grand.Web.Models.Customer;
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_ColumnsTwo";

    //title
    pagebuilder.AddTitleParts(T("PageTitle.Account").Text);
}
@section left
{
    @await Component.InvokeAsync("CustomerNavigation", new { selectedTabId = CustomerNavigationEnum.ChangePassword })
}
<form asp-route="CustomerChangePassword" method="post" v-on:submit.prevent="validateBeforeSubmit($event)">
    <section class="page account-page change-password-page pl-lg-3 pt-3 pt-lg-0">
        <h1 class="h2 generalTitle">@T("Account.ChangePassword")</h1>
        @if (!String.IsNullOrEmpty(Model.Result))
        {
            <section class="result alert alert-info">
                @Model.Result
            </section>
        }
        <div asp-validation-summary="ModelOnly" class="message-error"></div>

        <fieldset>
            <div class="form-fields">
                <fieldset class="form-group">
                    <label asp-for="OldPassword" class="col-form-label">@T("Account.ChangePassword.Fields.OldPassword"):</label>
                    <input asp-for="OldPassword" class="form-control" v-validate="'required'" />
                    <span class="field-validation-error">{{veeErrors.first('OldPassword')}}</span>
                    <span asp-validation-for="OldPassword"></span>
                </fieldset>
                <fieldset class="form-group">
                    <label asp-for="NewPassword" class="col-form-label">@T("Account.ChangePassword.Fields.NewPassword"):</label>
                    <input asp-for="NewPassword" class="form-control" v-validate="'required|min:NewPassword'" ref="newpassword" />
                    <span class="field-validation-error">{{veeErrors.first('NewPassword')}}</span>
                    <span asp-validation-for="NewPassword"></span>
                </fieldset>
                <fieldset class="form-group">
                    <label asp-for="ConfirmNewPassword" class="col-form-label">@T("Account.ChangePassword.Fields.ConfirmNewPassword"):</label>
                    <input asp-for="ConfirmNewPassword" class="form-control" v-validate="'required|confirmed:newpassword'" />
                    <span class="field-validation-error">{{veeErrors.first('ConfirmNewPassword')}}</span>
                    <span asp-validation-for="ConfirmNewPassword"></span>
                </fieldset>
            </div>
        </fieldset>
        <div class="text-xs-center">
            <input type="submit" class="btn btn-info change-password-button" value="@T("Account.ChangePassword.Button")" />
        </div>
    </section>
</form>
